using System.Collections.Generic;

namespace Solver
{
	internal class FibonacciNumbersSource
	{
		private readonly Number[] fib_;

		public FibonacciNumbersSource(int maxIndex)
		{
			fib_ = new Number[maxIndex + 1];
			fib_[0] = new Number(0);
			fib_[1] = new Number(1);
			fib_[2] = new Number(1);
			for (int index = 3; index <= maxIndex; index++)
				fib_[index] = SymMath.Add(fib_[index - 1], fib_[index - 2]);
		}

		public IEnumerable<Number> Fibs()
		{
			foreach (var f in fib_)
				yield return f;
		}

		public IEnumerable<string> StringFibs()
		{
			foreach (var f in fib_)
				yield return f.ToString();
		}

		public IEnumerable<long> Int64Fibs()
		{
			foreach (var f in fib_)
				yield return f.ToInt64();
		}
	}
}